import package.read_pdf as rp


# 读取宁波银行储蓄卡流水
def NB_Bank_tolist(file):
    # 读取pdf
    txt=rp.read_pdf_1(file)
    # 将文本按行分割
    txt_n=txt.split("\n")
    # 提取交易明细
    txt_list = []
    for index,row in enumerate(txt_n):
        # 去除首尾空格
        row = row.strip()
        # 如果最前方是日期格式，并且有9列元素时，则认为是表格
        if row.startswith("20"):  # 假设日期格式为"YYYY-MM-DD"
            row_list = row.split(" ")
            if len(row_list) == 9:
                row_list = [str(row_list[0]).strip(),f"{str(row_list[1]).strip()}_{str(row_list[5]).strip()}_{str(row_list[7]).strip()}",str(row_list[3]).strip()]
                txt_list.append(row_list)
    # 返回交易明细
    return txt_list

if __name__ == '__main__':
    print(123)